{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "44850fb7-fefa-439a-aebe-e1fbeb742d92",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "year = '2019'  # please specify the year, our experiments use 2019\n",
    "ca_his = pd.read_hdf('ca_his_raw_' + year + '.h5')\n",
    "\n",
    "### please comment this line if you don't want to do resampling\n",
    "ca_his = ca_his.resample('15T').mean().round(0)\n",
    "###\n",
    "\n",
    "ca_his = ca_his.fillna(0)\n",
    "print('check null value number', ca_his.isnull().any().sum())\n",
    "ca_his"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a69b8fb8-cdff-46fb-9371-9795bb57335a",
   "metadata": {},
   "outputs": [],
   "source": [
    "ca_his.to_hdf('ca_his_' + year + '.h5', key='t', mode='w')\n",
    "ca_his.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "197db169-a070-4edb-a8a5-0cffd7dae476",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "torch",
   "language": "python",
   "name": "torch"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
